﻿using System.Collections.Generic;
using System.Linq;
using UnityEngine;

[CreateAssetMenu(fileName = "Effect37-根据友军士兵的数量恢复资源数量", menuName = "Skill/Effect/Effect37-根据友军士兵的数量恢复资源数量", order = 37)]
public class Effect37 : EffectBase
{
    public override void Apply(Pair pair, GameEvent e, List<Chess> targets)
    {
        
        foreach (var chess in targets)
        {
            var resourcesCount = 0;
            foreach (var c in ChessManager.GetInstance().chessList)
            {
                if(c.GetChessSide() == chess.GetChessSide())
                    resourcesCount++;
            }
            PlayerResourcesManager.GetInstance().AddResources(pair.Chess.GetChessSide(), resourcesCount);
        }
    }
}